﻿using System;
using System.Runtime.Serialization;
using System.Xml.Linq;

namespace NCMIS.ObjectModel.MetaData
{
    /// <summary>
    /// Models the CMIS "AllowableActions" mechanism, which allows an application to discover the set of
    /// service operations that can currently be performed on a particular object, without having to actually
    /// invoke the service.
    /// </summary>
    [DataContract(Name = "allowableActions", Namespace = CmisNs.Cmis)]
    public class AllowableActions
    {
        #region Navigation Services

        /// <summary>
        /// Can get the descendants of the folder (getDescendants). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canGetDescendants")]
        public bool CanGetDescendants
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the sub-folder tree of the folder (getFolderTree). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canGetFolderTree")]
        public bool CanGetFolderTree
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the children of the folder (getChildren). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canGetChildren")]
        public bool CanGetChildren
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the parent/ancestor folder(s) of the folder (getFolderParent). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canGetFolderParent")]
        public bool CanGetFolderParent
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the parent folders of the object. (getObjectParents) Base Object: cmis:document, cmis:folder, cmis:policy.
        /// </summary>
        [DataMember(Name = "canGetObjectParents")]
        public bool CanGetObjectParents
        {
            get;
            set;
        }

        #endregion

        #region Object Services

        /// <summary>
        /// Can create a cmis:document Object in the folder (createDocument). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canCreateDocument")]
        public bool CanCreateDocument
        {
            get;
            set;
        }

        /// <summary>
        /// Can create a cmis:folder Object as a child of the specified  folder (createFolder). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canCreateFolder")]
        public bool CanCreateFolder
        {
            get;
            set;
        }

        /// <summary>
        /// Can create a Relationship in which this Object is a source (createRelationship). Base Object: cmis:document, cmis:folder.
        /// </summary>
        [DataMember(Name = "canCreateRelationship")]
        public bool CanCreateRelationship
        {
            get;
            set;
        }

        /// <summary>
        /// Can read the properties of this object (getProperties). Base Object: cmis:document, cmis:folder, cmis:relationship, cmis:policy.
        /// </summary>
        [DataMember(Name = "canGetProperties")]
        public bool CanGetProperties
        {
            get;
            set;
        }

        /// <summary>
        /// Can retrieve the renditions of this object (getRenditions). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canGetRenditions")]
        public bool CanGetRenditions
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the content stream for the Document object (getContentStream). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canGetContentStream")]
        public bool CanGetContentStream
        {
            get;
            set;
        }

        /// <summary>
        /// Can update the properties of this object (updateProperties). Base Object: cmis:document, cmis:folder, cmis:relationship, cmis:policy.
        /// </summary>
        [DataMember(Name = "canUpdateProperties")]
        public bool CanUpdateProperties
        {
            get;
            set;
        }

        /// <summary>
        /// Can move the object (moveObject). Base Object: cmis:document, cmis:folder, cmis:policy.
        /// </summary>
        [DataMember(Name = "canMoveObject")]
        public bool CanMoveObject
        {
            get;
            set;
        }

        /// <summary>
        /// Can delete an object that is a child of this folder (deleteObject). Base Object: cmis:document, cmis:folder, cmis:relationship, cmis:policy.
        /// </summary>
        [DataMember(Name = "canDeleteObject")]
        public bool CanDeleteObject
        {
            get;
            set;
        }

        /// <summary>
        /// Can set the content stream for the Document object (setContentStream). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canSetContentStream")]
        public bool CanSetContentStream
        {
            get;
            set;
        }

        /// <summary>
        /// Can delete the content stream for the Document object (deleteContentStream). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canDeleteContentStream")]
        public bool CanDeleteContentStream
        {
            get;
            set;
        }

        /// <summary>
        ///  Can delete the folder and all contained objects (deleteTree). Base Object: cmis:folder.
        /// </summary>
        [DataMember(Name = "canDeleteTree")]
        public bool CanDeleteTree
        {
            get;
            set;
        }

        #endregion

        #region Multi-Filing Services

        /// <summary>
        /// Can file the document in a folder (addObjectToFolder). Base Object: cmis:document, cmis:policy.
        /// </summary>
        [DataMember(Name = "canAddObjectToFolder")]
        public bool CanAddObjectToFolder
        {
            get;
            set;
        }

        /// <summary>
        /// Can unfile the specified document from a folder (removeObjectFromFolder). Base Object: cmis:document, cmis:policy.
        /// </summary>
        [DataMember(Name = "canRemoveObjectFromFolder")]
        public bool CanRemoveObjectFromFolder
        {
            get;
            set;
        }

        #endregion

        #region Versioning Services

        [DataMember(Name = "canCheckOut")]
        public bool CanCheckOut
        {
            get;
            set;
        }

        /// <summary>
        /// Can cancel the check out the Document object (cancelCheckOut). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canCancelCheckOut")]
        public bool CanCancelCheckOut
        {
            get;
            set;
        }

        /// <summary>
        /// Can check in the Document object (checkIn). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canCheckIn")]
        public bool CanCheckIn
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the version series for the Document object (getAllVersions). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canGetAllVersions")]
        public bool CanGetAllVersions
        {
            get;
            set;
        }

        #endregion

        #region Relationship Services

        /// <summary>
        ///  Can check out the Document object (checkOut). Base Object: cmis:document.
        /// </summary>
        [DataMember(Name = "canGetObjectRelationships")]
        public bool CanGetObjectRelationships
        {
            get;
            set;
        }

        #endregion

        #region Policy Services

        /// <summary>
        /// Can apply a policy to the Object (applyPolicy). Base Object: cmis:document, cmis:folder.
        /// </summary>
        [DataMember(Name = "canApplyPolicy")]
        public bool CanApplyPolicy
        {
            get;
            set;
        }

        /// <summary>
        /// Can remove the specified  policy from an Object (removePolicy). Base Object: cmis:document, cmis:folder.
        /// </summary>
        [DataMember(Name = "canRemovePolicy")]
        public bool CanRemovePolicy
        {
            get;
            set;
        }

        /// <summary>
        /// Can get the list of Policies applied to the Object (getAppliedPolicies). Base Object: cmis:document, cmis:folder.
        /// </summary>
        [DataMember(Name = "canGetAppliedPolicies")]
        public bool CanGetAppliedPolicies
        {
            get;
            set;
        }

        #endregion

        #region ACL Services

        /// <summary>
        /// Can get ACL for object (getACL). Base Object: cmis:document, cmis:folder, cmis:relationship, cmis:policy.
        /// </summary>
        [DataMember(Name = "canGetACL")]
        public bool CanGetACL
        {
            get;
            set;
        }

        /// <summary>
        /// Can apply ACL to this object (applyACL). Base Object: cmis:document, cmis:folder, cmis:relationship, cmis:policy.
        /// </summary>
        [DataMember(Name = "canApplyACL")]
        public bool CanApplyACL
        {
            get;
            set;
        }

        #endregion
    }
}
